package springbootjedisdata.demo;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;

@SpringBootTest
public class Redis20SpringBoot {

    @Autowired
    private RedisTemplate redisTemplate;

    @Test
    public void contestLoads(){
        //redisTemplate
        //操作不同的数据类型 api和指令相同
        //opsForValue == String
        //opsForList == list
        //
        //
        //
        //

        //除了基本操作，常用的方法，可以直接redisTemplate操作
        redisTemplate.opsForValue().set("name","张三");
        System.out.println(redisTemplate.opsForValue().get("name"));
        redisTemplate.opsForValue().set("name","张三");

        //获取连接对象
//        RedisConnection connection = redisTemplate.getConnectionFactory().getConnection();


    }
}
